<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Mask_Rcnn | ChenBlue | 飞雪连天射白鹿 笑书神侠倚碧鸳</title>

  
  <meta name="author" content="ChenBlue">
  

  
  <meta name="description" content="学习笔记">
  

  
  
  <meta name="keywords" content="环境搭建">
  

  <meta id="viewport" name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">

  <meta property="og:title" content="Mask_Rcnn"/>

  <meta property="og:site_name" content="ChenBlue"/>

  
  <meta property="og:image" content="/blog/favicon.ico"/>
  

  <link href="/blog/favicon.ico" rel="icon">
  <link rel="alternate" href="/blog/atom.xml" title="ChenBlue" type="application/atom+xml">
  <link rel="stylesheet" href="/blog/css/style.css" media="screen" type="text/css">
<meta name="generator" content="Hexo 5.4.0"></head>


<body>
<div class="blog">
  <div class="content">

    <header>
  <div class="site-branding">
    <h1 class="site-title">
      <a href="/blog/">ChenBlue</a>
    </h1>
    <p class="site-description">飞雪连天射白鹿 笑书神侠倚碧鸳</p>
  </div>
  <nav class="site-navigation">
    <ul>
      
    </ul>
  </nav>
</header>

    <main class="site-main posts-loop">
    <article>

  
    
    <h3 class="article-title"><span>Mask_Rcnn</span></h3>
    
  

  <div class="article-top-meta">
    <span class="posted-on">
      <a href="/blog/2021/07/25/Mask_Rcnn/" rel="bookmark">
        <time class="entry-date published" datetime="2021-07-25T09:05:03.000Z">
          2021-07-25
        </time>
      </a>
    </span>
  </div>


  

  <div class="article-content">
    <div class="entry">
      
        <h1 id="环境的搭建"><a href="#环境的搭建" class="headerlink" title="环境的搭建"></a>环境的搭建</h1><h2 id="安装-Mask-Rcnn"><a href="#安装-Mask-Rcnn" class="headerlink" title="安装 Mask_Rcnn"></a>安装 Mask_Rcnn</h2><p><strong>下载源码</strong></p>
<pre class="language-none"><code class="language-none">git clone https:&#x2F;&#x2F;github.com&#x2F;matterport&#x2F;Mask_RCNN</code></pre>
<p><strong>安装依赖</strong></p>
<p>安装前先修改 requirements.txt 这个文件。</p>
<pre class="language-none"><code class="language-none">diff --git a&#x2F;requirements.txt b&#x2F;requirements.txt
index bd64785..eabf100 100644
--- a&#x2F;requirements.txt
+++ b&#x2F;requirements.txt
@@ -1,12 +1,12 @@
-numpy
+numpy&#x3D;&#x3D;1.16.1
 scipy
 Pillow
 cython
 matplotlib
 scikit-image
-tensorflow&gt;&#x3D;1.3.0
-keras&gt;&#x3D;2.0.8
+tensorflow&#x3D;&#x3D;1.5.0
+keras&#x3D;&#x3D;2.1.4
 opencv-python</code></pre>

<pre class="language-none"><code class="language-none">pip3 install -r requirements.txt</code></pre>
<p><strong>安装 Mask_Rcnn</strong></p>
<pre class="language-none"><code class="language-none">python3 setup.py install</code></pre>
<p>根据readme 下载训练好的数据集 <code>mask_rcnn_coco.h5</code></p>
<h2 id="安装demo依赖库"><a href="#安装demo依赖库" class="headerlink" title="安装demo依赖库"></a>安装demo依赖库</h2><pre class="language-none"><code class="language-none">git clone https:&#x2F;&#x2F;github.com&#x2F;cocodataset&#x2F;cocoapi.git

cd cocoapi&#x2F;PythonAPI

make

make install</code></pre>
<h2 id="运行-demo"><a href="#运行-demo" class="headerlink" title="运行 demo"></a>运行 demo</h2><h3 id="将-Mask-RCNN-sample-demo-ipynb-下的-ipynb-文件转换成-py-文件"><a href="#将-Mask-RCNN-sample-demo-ipynb-下的-ipynb-文件转换成-py-文件" class="headerlink" title="将 Mask_RCNN/sample/demo.ipynb 下的 .ipynb 文件转换成 . py 文件"></a>将 Mask_RCNN/sample/demo.ipynb 下的 .ipynb 文件转换成 . py 文件</h3><pre class="language-none"><code class="language-none">pip3 install jupyter

jupyter nbconvert --to script xxx.ipynb </code></pre>
<p>++这里遇到一个奇怪的问题。就是install之后需要重启电脑才能使用 jupyter 这个指令。且仅在终端里面有用，SSH里面还是会报错。找不到这个命令++</p>
<pre class="language-none"><code class="language-none">python demo.py</code></pre>
<p>如果报错 get_ipython().run_line_magic(‘matplotlib’,’inline’)<br>把这行注释掉即可</p>

      
    </div>

  </div>

  <div class="article-footer">
    <div class="article-meta pull-left">

    
      

    <span class="post-categories">
      <i class="icon-categories"></i>
        <a href="/blog/categories/环境搭建/">环境搭建</a>
    </span>
    

    
    

    <span class="post-tags">
      <i class="icon-tags"></i>
        <a href="/blog/tags/环境搭建/">环境搭建</a>
    </span>
    

    </div>

    
  </div>
</article>

  









    </main>

    <footer class="site-footer">
  <p class="site-info">
    Proudly powered by <a href="https://hexo.io/" target="_blank">Hexo</a> and
    Theme by <a href="https://github.com/CodeDaraW/Hacker" target="_blank">Hacker</a>
    </br>
    
    &copy; 2023 ChenBlue
    
  </p>
</footer>
    
    
  </div>
</div>
</body>
</html>